<template>
    <div>
        <el-table :data="secklist" border style="width: 100%">
            <el-table-column prop="title" label="活动名称" width="180">
            </el-table-column>
            <el-table-column label="状态" width="180">
                <template slot-scope="item">
                    <div>
                        <el-tag v-if="item.row.status == 1" type="success" plain size="medium">启用</el-tag>
                        <el-tag v-else type="danger" plain size="medium">禁用</el-tag>
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="address" label="操作">
                <template slot-scope="item">
                    <div>
                        <el-button type="primary" @click="edit(item.row.id)">编辑</el-button>
                        <el-button type="danger" @click="del(item.row.id)">删除</el-button>
                    </div>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>
<script>
import { seckdelete } from "../../request/api"
import { mapGetters, mapActions } from 'vuex';
export default {
    data() {
        return {

        }
    },
    methods: {
        ...mapActions({
            getSeck: "seck/getSeckListActions"
        }),
        edit(id) {
            this.$emit("edit", id)
        },
        del(id) {

            this.$confirm('此操作不可逆, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                //   点击删除删除数据
                seckdelete({ id })
                    .then(res => {
                        if(res.code==200){
                            this.getSeck()
                        }
                    })

                this.$message({
                    type: 'success',
                    message: '删除成功!'
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        }
    },
    mounted() {
        this.getSeck()
    },
    watch: {},
    computed: {
        ...mapGetters({
            secklist: "seck/getSeck"
        })
    },
    filters: {},
    components: {}
}
</script>
<style scoped></style>